package com.hzw.saas.api.old.storage.bo;

import java.io.Serializable;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * 文件分片信息业务对象
 *
 * @author zzl
 * @since 02/19/2021
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
// @ApiModel("文件Loc分片信息")
public class LocChunkBO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 分片ID
     */
    @ApiModelProperty(value = "分片ID", position = 1)
    private String chunkId;

    /**
     * 文件ID
     */
    @ApiModelProperty(value = "文件ID", position = 2, required = true)
    @NotBlank(message = "文件ID不可为空")
    private String fileId;

    /**
     * 起始字节数，从1开始
     */
    @ApiModelProperty(value = "起始字节数，从1开始", position = 3, required = true)
    @NotNull(message = "文件分片起始字节数不可为空")
    private Long startBytes;

    /**
     * 结束字节数
     */
    @ApiModelProperty(value = "结束字节数", position = 4, required = true)
    @NotNull(message = "文件分片结束字节数不可为空")
    private Long endBytes;

    /**
     * 当前分片摘要，MD5
     */
    @ApiModelProperty(value = "当前分片摘要，不为空时会对其进行校验", position = 5)
    private String digest;

    /**
     * 文件摘要类型
     * 备用
     */
    @ApiModelProperty(value = "摘要类型（可选），默认为MD5，支持MD5,SHA1,SHA256", position = 11)
    private String digestType;

    /**
     * 分片状态
     */
    @ApiModelProperty(value = "分片状态, 1-已合并, 2-新增", position = 6)
    private Integer status;

    @Override
    public String toString() {
        return "{" +
            "chunkId='" + chunkId + '\'' +
            ", fileId='" + fileId + '\'' +
            ", startBytes=" + startBytes +
            ", endBytes=" + endBytes +
            ", digest='" + digest + '\'' +
            ", status=" + status +
            '}';
    }
}
